package com.hare.harelearn.DesignPattern.工厂模式.简单工厂模式;

import org.springframework.web.context.support.GroovyWebApplicationContext;

public class PhoneFactory {
    public static void main(String[] args) {
        System.out.println(makePhone("xiaomi").name());
    }
    public static MakePhone makePhone(String type){
        MakePhone phone = null;
        switch (type){
            case "apple":
                phone = new ApplePhone();
                break;
            case "huawei":
                phone = new HuaWeiPhone();
                break;
            default:
                phone = new XiaoMiPhone();
                break;
        }
        return phone;
    }
}
